package com.yicong.ants.bean.order;

import android.view.View;

import java.util.List;



/**
 * 订单提交的 中转适配bean对象
 *
 * @author cchao
 * @version 2019-08-22.
 */

public class OrderAdapterBean {

    public OrderAdapterBean() {
    }

    public String getGoodsType() {
        return this.goodsType;
    }

    public String getScenicId() {
        return this.scenicId;
    }

    public String getScenicName() {
        return this.scenicName;
    }

    public String getProductId() {
        return this.productId;
    }

    public String getProductName() {
        return this.productName;
    }

    public String getProductImage() {
        return this.productImage;
    }

    public String getOriginalPrice() {
        return this.originalPrice;
    }

    public String getCurrentPrice() {
        return this.currentPrice;
    }

    public String getUnitPrice() {
        return this.unitPrice;
    }

    public String getTotalAmount() {
        return this.totalAmount;
    }

    public int getQty() {
        return this.qty;
    }

    public String getDiscount() {
        return this.discount;
    }

    public String getVisitTime() {
        return this.visitTime;
    }

    public boolean isCheckDiscount() {
        return this.checkDiscount;
    }

    public List<VisitorInfo> getMVisitorsInfo() {
        return this.mVisitorsInfo;
    }

    public OrderAdapterBean setGoodsType(String goodsType) {
        this.goodsType = goodsType;
        return this;
    }

    public OrderAdapterBean setScenicId(String scenicId) {
        this.scenicId = scenicId;
        return this;
    }

    public OrderAdapterBean setScenicName(String scenicName) {
        this.scenicName = scenicName;
        return this;
    }

    public OrderAdapterBean setProductId(String productId) {
        this.productId = productId;
        return this;
    }

    public OrderAdapterBean setProductName(String productName) {
        this.productName = productName;
        return this;
    }

    public OrderAdapterBean setProductImage(String productImage) {
        this.productImage = productImage;
        return this;
    }

    public OrderAdapterBean setOriginalPrice(String originalPrice) {
        this.originalPrice = originalPrice;
        return this;
    }

    public OrderAdapterBean setCurrentPrice(String currentPrice) {
        this.currentPrice = currentPrice;
        return this;
    }

    public OrderAdapterBean setUnitPrice(String unitPrice) {
        this.unitPrice = unitPrice;
        return this;
    }

    public OrderAdapterBean setTotalAmount(String totalAmount) {
        this.totalAmount = totalAmount;
        return this;
    }

    public OrderAdapterBean setQty(int qty) {
        this.qty = qty;
        return this;
    }

    public OrderAdapterBean setDiscount(String discount) {
        this.discount = discount;
        return this;
    }

    public OrderAdapterBean setVisitTime(String visitTime) {
        this.visitTime = visitTime;
        return this;
    }

    public OrderAdapterBean setCheckDiscount(boolean checkDiscount) {
        this.checkDiscount = checkDiscount;
        return this;
    }

    public OrderAdapterBean setVisibleCouponCheck(int visibleCouponCheck) {
        this.visibleCouponCheck = visibleCouponCheck;
        return this;
    }

    public OrderAdapterBean setDisplayPrice(String displayPrice) {
        this.displayPrice = displayPrice;
        return this;
    }

    public OrderAdapterBean setMVisitorsInfo(List<VisitorInfo> mVisitorsInfo) {
        this.mVisitorsInfo = mVisitorsInfo;
        return this;
    }

    public boolean equals(final Object o) {
        if (o == this) return true;
        if (!(o instanceof OrderAdapterBean)) return false;
        final OrderAdapterBean other = (OrderAdapterBean) o;
        if (!other.canEqual((Object) this)) return false;
        final Object this$goodsType = this.getGoodsType();
        final Object other$goodsType = other.getGoodsType();
        if (this$goodsType == null ? other$goodsType != null : !this$goodsType.equals(other$goodsType))
            return false;
        final Object this$scenicId = this.getScenicId();
        final Object other$scenicId = other.getScenicId();
        if (this$scenicId == null ? other$scenicId != null : !this$scenicId.equals(other$scenicId))
            return false;
        final Object this$scenicName = this.getScenicName();
        final Object other$scenicName = other.getScenicName();
        if (this$scenicName == null ? other$scenicName != null : !this$scenicName.equals(other$scenicName))
            return false;
        final Object this$productId = this.getProductId();
        final Object other$productId = other.getProductId();
        if (this$productId == null ? other$productId != null : !this$productId.equals(other$productId))
            return false;
        final Object this$productName = this.getProductName();
        final Object other$productName = other.getProductName();
        if (this$productName == null ? other$productName != null : !this$productName.equals(other$productName))
            return false;
        final Object this$productImage = this.getProductImage();
        final Object other$productImage = other.getProductImage();
        if (this$productImage == null ? other$productImage != null : !this$productImage.equals(other$productImage))
            return false;
        final Object this$originalPrice = this.getOriginalPrice();
        final Object other$originalPrice = other.getOriginalPrice();
        if (this$originalPrice == null ? other$originalPrice != null : !this$originalPrice.equals(other$originalPrice))
            return false;
        final Object this$currentPrice = this.getCurrentPrice();
        final Object other$currentPrice = other.getCurrentPrice();
        if (this$currentPrice == null ? other$currentPrice != null : !this$currentPrice.equals(other$currentPrice))
            return false;
        final Object this$unitPrice = this.getUnitPrice();
        final Object other$unitPrice = other.getUnitPrice();
        if (this$unitPrice == null ? other$unitPrice != null : !this$unitPrice.equals(other$unitPrice))
            return false;
        final Object this$totalAmount = this.getTotalAmount();
        final Object other$totalAmount = other.getTotalAmount();
        if (this$totalAmount == null ? other$totalAmount != null : !this$totalAmount.equals(other$totalAmount))
            return false;
        if (this.getQty() != other.getQty()) return false;
        final Object this$discount = this.getDiscount();
        final Object other$discount = other.getDiscount();
        if (this$discount == null ? other$discount != null : !this$discount.equals(other$discount))
            return false;
        final Object this$visitTime = this.getVisitTime();
        final Object other$visitTime = other.getVisitTime();
        if (this$visitTime == null ? other$visitTime != null : !this$visitTime.equals(other$visitTime))
            return false;
        if (this.isCheckDiscount() != other.isCheckDiscount()) return false;
        if (this.getVisibleCouponCheck() != other.getVisibleCouponCheck()) return false;
        final Object this$displayPrice = this.getDisplayPrice();
        final Object other$displayPrice = other.getDisplayPrice();
        if (this$displayPrice == null ? other$displayPrice != null : !this$displayPrice.equals(other$displayPrice))
            return false;
        final Object this$mVisitorsInfo = this.getMVisitorsInfo();
        final Object other$mVisitorsInfo = other.getMVisitorsInfo();
        if (this$mVisitorsInfo == null ? other$mVisitorsInfo != null : !this$mVisitorsInfo.equals(other$mVisitorsInfo))
            return false;
        return true;
    }

    protected boolean canEqual(final Object other) {
        return other instanceof OrderAdapterBean;
    }

    public int hashCode() {
        final int PRIME = 59;
        int result = 1;
        final Object $goodsType = this.getGoodsType();
        result = result * PRIME + ($goodsType == null ? 43 : $goodsType.hashCode());
        final Object $scenicId = this.getScenicId();
        result = result * PRIME + ($scenicId == null ? 43 : $scenicId.hashCode());
        final Object $scenicName = this.getScenicName();
        result = result * PRIME + ($scenicName == null ? 43 : $scenicName.hashCode());
        final Object $productId = this.getProductId();
        result = result * PRIME + ($productId == null ? 43 : $productId.hashCode());
        final Object $productName = this.getProductName();
        result = result * PRIME + ($productName == null ? 43 : $productName.hashCode());
        final Object $productImage = this.getProductImage();
        result = result * PRIME + ($productImage == null ? 43 : $productImage.hashCode());
        final Object $originalPrice = this.getOriginalPrice();
        result = result * PRIME + ($originalPrice == null ? 43 : $originalPrice.hashCode());
        final Object $currentPrice = this.getCurrentPrice();
        result = result * PRIME + ($currentPrice == null ? 43 : $currentPrice.hashCode());
        final Object $unitPrice = this.getUnitPrice();
        result = result * PRIME + ($unitPrice == null ? 43 : $unitPrice.hashCode());
        final Object $totalAmount = this.getTotalAmount();
        result = result * PRIME + ($totalAmount == null ? 43 : $totalAmount.hashCode());
        result = result * PRIME + this.getQty();
        final Object $discount = this.getDiscount();
        result = result * PRIME + ($discount == null ? 43 : $discount.hashCode());
        final Object $visitTime = this.getVisitTime();
        result = result * PRIME + ($visitTime == null ? 43 : $visitTime.hashCode());
        result = result * PRIME + (this.isCheckDiscount() ? 79 : 97);
        result = result * PRIME + this.getVisibleCouponCheck();
        final Object $displayPrice = this.getDisplayPrice();
        result = result * PRIME + ($displayPrice == null ? 43 : $displayPrice.hashCode());
        final Object $mVisitorsInfo = this.getMVisitorsInfo();
        result = result * PRIME + ($mVisitorsInfo == null ? 43 : $mVisitorsInfo.hashCode());
        return result;
    }

    public String toString() {
        return "OrderAdapterBean(goodsType=" + this.getGoodsType() + ", scenicId=" + this.getScenicId() + ", scenicName=" + this.getScenicName() + ", productId=" + this.getProductId() + ", productName=" + this.getProductName() + ", productImage=" + this.getProductImage() + ", originalPrice=" + this.getOriginalPrice() + ", currentPrice=" + this.getCurrentPrice() + ", unitPrice=" + this.getUnitPrice() + ", totalAmount=" + this.getTotalAmount() + ", qty=" + this.getQty() + ", discount=" + this.getDiscount() + ", visitTime=" + this.getVisitTime() + ", checkDiscount=" + this.isCheckDiscount() + ", visibleCouponCheck=" + this.getVisibleCouponCheck() + ", displayPrice=" + this.getDisplayPrice() + ", mVisitorsInfo=" + this.getMVisitorsInfo() + ")";
    }

    public interface GoodsType {
        // 特惠票
        String DiscountScenic = "1";
        // 二次消费
        String AddedProject = "2";
        // 体验卡无次数购买免预约 9.9
        String TrailPartnerScenic = "3";
        // 预约景区购买
        String AdvanceScenic = "4";
        // 旅游卡月卡
        String Card = "Card";
    }

    String goodsType = GoodsType.DiscountScenic;

    String scenicId;
    String scenicName;
    String productId;
    String productName;
    String productImage;
    // 除了 特惠景区，originalPrice == currentPrice
    String originalPrice;
    String currentPrice;
    // 单价和totalAmount 是用于结算
    String unitPrice;
    String totalAmount;
    int qty = 1;
    // 特惠景区 折扣值
    String discount;
    String visitTime;

    // 是否选中折扣（景区详情和结算页）
    boolean checkDiscount = true;

    // 是否显示折扣信息 选择框
    int visibleCouponCheck = View.GONE;
    /**
     * 展示的价格
     */
    String displayPrice = originalPrice;

    List<VisitorInfo> mVisitorsInfo;

    public void updateTotalAmount() {
        if (mVisitorsInfo == null) {
            qty = 1;
        } else {
            qty = mVisitorsInfo.size();
        }
        unitPrice = checkDiscount ? currentPrice : originalPrice;
        totalAmount = String.valueOf(Float.parseFloat(unitPrice) * qty);
    }

    public int getVisibleCouponCheck() {
        if (goodsType.equals(GoodsType.DiscountScenic)) {
            return View.VISIBLE;
        }
        return View.GONE;
    }

    // 页面上显示的价格
    public String getDisplayPrice() {
        displayPrice = originalPrice;
        if (goodsType.equals(GoodsType.DiscountScenic)) {
            displayPrice = currentPrice;
        }
        return displayPrice;
    }

    
    public static class VisitorInfo {
        String name;
        String mobile;
        String id_num;

        public VisitorInfo() {
        }

        public String getName() {
            return this.name;
        }

        public String getMobile() {
            return this.mobile;
        }

        public String getId_num() {
            return this.id_num;
        }

        public VisitorInfo setName(String name) {
            this.name = name;
            return this;
        }

        public VisitorInfo setMobile(String mobile) {
            this.mobile = mobile;
            return this;
        }

        public VisitorInfo setId_num(String id_num) {
            this.id_num = id_num;
            return this;
        }

        public boolean equals(final Object o) {
            if (o == this) return true;
            if (!(o instanceof VisitorInfo)) return false;
            final VisitorInfo other = (VisitorInfo) o;
            if (!other.canEqual((Object) this)) return false;
            final Object this$name = this.getName();
            final Object other$name = other.getName();
            if (this$name == null ? other$name != null : !this$name.equals(other$name))
                return false;
            final Object this$mobile = this.getMobile();
            final Object other$mobile = other.getMobile();
            if (this$mobile == null ? other$mobile != null : !this$mobile.equals(other$mobile))
                return false;
            final Object this$id_num = this.getId_num();
            final Object other$id_num = other.getId_num();
            if (this$id_num == null ? other$id_num != null : !this$id_num.equals(other$id_num))
                return false;
            return true;
        }

        protected boolean canEqual(final Object other) {
            return other instanceof VisitorInfo;
        }

        public int hashCode() {
            final int PRIME = 59;
            int result = 1;
            final Object $name = this.getName();
            result = result * PRIME + ($name == null ? 43 : $name.hashCode());
            final Object $mobile = this.getMobile();
            result = result * PRIME + ($mobile == null ? 43 : $mobile.hashCode());
            final Object $id_num = this.getId_num();
            result = result * PRIME + ($id_num == null ? 43 : $id_num.hashCode());
            return result;
        }

        public String toString() {
            return "OrderAdapterBean.VisitorInfo(name=" + this.getName() + ", mobile=" + this.getMobile() + ", id_num=" + this.getId_num() + ")";
        }
    }
}
